home *** CD-ROM | disk | FTP | other *** search
/ Whiteline: Alpha / Whiteline Alpha.iso / linux / atari / source / source.lzh / atari-linux-0.01pl3 / fs / proc / kmsg.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-06-05  |  1.6 KB  |  78 lines

  1. /*
  2.  *  linux/fs/proc/kmsg.c
  3.  *
  4.  *  Copyright (C) 1992  by Linus Torvalds
  5.  *
  6.  */
  7.  
  8. #include <linux/types.h>
  9. #include <linux/errno.h>
  10. #include <linux/sched.h>
  11. #include <linux/kernel.h>
  12. #include <linux/tty.h>
  13.  
  14. #include <asm/segment.h>
  15. #include <asm/io.h>
  16.  
  17. extern unsigned long log_size;
  18. extern struct wait_queue * log_wait;
  19.  
  20. asmlinkage int sys_syslog(int type, char * bug, int count);
  21.  
  22. static int kmsg_open(struct inode * inode, struct file * file)
  23. {
  24.     return sys_syslog(1,NULL,0);
  25. }
  26.  
  27. static void kmsg_release(struct inode * inode, struct file * file)
  28. {
  29.     (void) sys_syslog(0,NULL,0);
  30. }
  31.  
  32. static int kmsg_read(struct inode * inode, struct file * file,char * buf, int count)
  33. {
  34.     return sys_syslog(2,buf,count);
  35. }
  36.  
  37. static int kmsg_select(struct inode *inode, struct file *file, int sel_type, select_table * wait)
  38. {
  39.     if (sel_type != SEL_IN)
  40.         return 0;
  41.     if (log_size)
  42.         return 1;
  43.     select_wait(&log_wait, wait);
  44.     return 0;
  45. }
  46.  
  47.  
  48. static struct file_operations proc_kmsg_operations = {
  49.     NULL,        /* kmsg_lseek */
  50.     kmsg_read,
  51.     NULL,        /* kmsg_write */
  52.     NULL,        /* kmsg_readdir */
  53.     kmsg_select,    /* kmsg_select */
  54.     NULL,        /* kmsg_ioctl */
  55.     NULL,        /* mmap */
  56.     kmsg_open,
  57.     kmsg_release,
  58.     NULL        /* can't fsync */
  59. };
  60.  
  61. struct inode_operations proc_kmsg_inode_operations = {
  62.     &proc_kmsg_operations,    /* default base directory file-ops */
  63.     NULL,            /* create */
  64.     NULL,            /* lookup */
  65.     NULL,            /* link */
  66.     NULL,            /* unlink */
  67.     NULL,            /* symlink */
  68.     NULL,            /* mkdir */
  69.     NULL,            /* rmdir */
  70.     NULL,            /* mknod */
  71.     NULL,            /* rename */
  72.     NULL,            /* readlink */
  73.     NULL,            /* follow_link */
  74.     NULL,            /* bmap */
  75.     NULL,            /* truncate */
  76.     NULL            /* permission */
  77. };
  78.